package com.gsnd.briuppts.service.impl;

import com.gsnd.briuppts.entity.BaseAuthority;
import com.gsnd.briuppts.entity.Do.BaseAuthorityExtend;
import com.gsnd.briuppts.mapper.BaseAuthorityMapper;
import com.gsnd.briuppts.mapper.BaseRoleMapper;
import com.gsnd.briuppts.service.BaseAuthorityService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

@Service
public class BaseAuthorityServiceImpl implements BaseAuthorityService {
    @Autowired
    BaseAuthorityMapper baseAuthorityMapper;
    @Autowired
    BaseRoleMapper baseRoleMapper;
    @Override
    public List<BaseAuthority> findAllAuthorities(String accountId) {
        List<String> roleIds = baseRoleMapper.getRoleArrayByAccountId(accountId);
        return baseAuthorityMapper.getAllByRoleIds(roleIds);

    }

    @Override
    public List<BaseAuthorityExtend> findAllAuthoritiesTree(String accountId) {
        List<String> roleIds = baseRoleMapper.getRoleArrayByAccountId(accountId);
        return baseAuthorityMapper.getAllByRoleIdsTree(roleIds);
    }
}

